Hi, |
Re: Create a DXL Attribute
Look up "create (attribute definition)" in the DXL Reference Manual. Here's a simple example: create object type "Boolean" (default "False") attribute "MyNewAttr"
|
Re: Create a DXL Attribute mcnairk - Tue Aug 30 08:13:45 EDT 2011
Look up "create (attribute definition)" in the DXL Reference Manual. Here's a simple example: create object type "Boolean" (default "False") attribute "MyNewAttr"
string NameAttr = "Whatever" create(object type "string" dxl DxlCode attribute NameAttr) Note that the code will generate some kind of data obj.attrDXLName = Results and 'Results' will need to match your attr 'type'; most attr DXL will be type 'string'.
|
Re: Create a DXL Attribute
Thanks Ken and Louie for your help. string NameAttr = "Whatever" Buffer DXLsrc = create DXLsrc = Line 1 DXLsrc += Line 2 . . . string DxlCode = stringOf DXLsrc delete DXLsrc create(object type "string" dxl DxlCode attribute NameAttr)
|
Re: Create a DXL Attribute melman - Fri Sep 02 05:13:53 EDT 2011
Thanks Ken and Louie for your help. string NameAttr = "Whatever" Buffer DXLsrc = create DXLsrc = Line 1 DXLsrc += Line 2 . . . string DxlCode = stringOf DXLsrc delete DXLsrc create(object type "string" dxl DxlCode attribute NameAttr)
Nothing wrong with that, but perhaps these two little technques have some merit: string NameAttr = "Whatever" Buffer DXLsrc = create DXLsrc = "string Text = obj.\"Object Text\"" DXLsrc += "if (null Text)//" DXLsrc += "then obj.attrDXLName = \"Text is null\"" DXLsrc += "else obj.attrDXLName = \"There is Text\"" string DxlCode = stringOf DXLsrc delete DXLsrc print "DxlCode [" DxlCode "]\n" create(object type "string" dxl DxlCode attribute NameAttr)
... create(object type "string" dxl (tempStringOf(DXLsrc)) attribute NameAttr) delete(DXLsrc)
string NameAttr = "Whatever" string DxlCode = "string Text = obj.\"Object Text\" if (null Text)// then obj.attrDXLName = \"Text is null\" else obj.attrDXLName = \"There is Text\" " // end definition of string DxlCode create(object type "string" dxl DxlCode attribute NameAttr) print "DxlCode [" DxlCode "]\n"
|
Re: Create a DXL Attribute llandale - Fri Sep 02 12:03:22 EDT 2011
Nothing wrong with that, but perhaps these two little technques have some merit: string NameAttr = "Whatever" Buffer DXLsrc = create DXLsrc = "string Text = obj.\"Object Text\"" DXLsrc += "if (null Text)//" DXLsrc += "then obj.attrDXLName = \"Text is null\"" DXLsrc += "else obj.attrDXLName = \"There is Text\"" string DxlCode = stringOf DXLsrc delete DXLsrc print "DxlCode [" DxlCode "]\n" create(object type "string" dxl DxlCode attribute NameAttr)
... create(object type "string" dxl (tempStringOf(DXLsrc)) attribute NameAttr) delete(DXLsrc)
string NameAttr = "Whatever" string DxlCode = "string Text = obj.\"Object Text\" if (null Text)// then obj.attrDXLName = \"Text is null\" else obj.attrDXLName = \"There is Text\" " // end definition of string DxlCode create(object type "string" dxl DxlCode attribute NameAttr) print "DxlCode [" DxlCode "]\n"
I will consider them in the next task. Thanks for your help. Knut |
Re: Create a DXL Attribute llandale - Fri Sep 02 12:03:22 EDT 2011
Nothing wrong with that, but perhaps these two little technques have some merit: string NameAttr = "Whatever" Buffer DXLsrc = create DXLsrc = "string Text = obj.\"Object Text\"" DXLsrc += "if (null Text)//" DXLsrc += "then obj.attrDXLName = \"Text is null\"" DXLsrc += "else obj.attrDXLName = \"There is Text\"" string DxlCode = stringOf DXLsrc delete DXLsrc print "DxlCode [" DxlCode "]\n" create(object type "string" dxl DxlCode attribute NameAttr)
... create(object type "string" dxl (tempStringOf(DXLsrc)) attribute NameAttr) delete(DXLsrc)
string NameAttr = "Whatever" string DxlCode = "string Text = obj.\"Object Text\" if (null Text)// then obj.attrDXLName = \"Text is null\" else obj.attrDXLName = \"There is Text\" " // end definition of string DxlCode create(object type "string" dxl DxlCode attribute NameAttr) print "DxlCode [" DxlCode "]\n"
I would like to create the DXL attribute by way of a DXL Menu. I have a recognized menu and added the necesary *.idx and *.hlp files. My question is, is it possible to add a create line within the same dxl attribute script file, or would it be better to create the dxl attribute in a separate script file and call the script that creates the attribute? I would just like to avoid having to add the code and create the new attribute in each module I plan to use it and prefer to just go to the menu and select from the pulldown and have the dxl attribute generated. Thanks in advance! |
Re: Create a DXL Attribute SystemAdmin - Thu Dec 01 14:33:47 EST 2011
This gets hard to read as you have to escape with a slash all the double quotes and all the slashes. I could not keep up with those that were 50 lines long, but suspect many other folks can handle it.
This is actually realistic since you have already deployed your addins in some hard coded spot on the network.
The Deploy part is pretty straight forward:
Debug mode would certainly print DxlCode. I've been tempted to write a simple program that accepts a string and escapes the quotes and the slashes. Then I'd get the code to work in an attribute, copy and past into the program, then copy and paste the results into the "string DxlCode" statement above. -Louie "Normal folks" means "Standard Users"! |
Re: Create a DXL Attribute llandale - Thu Dec 01 16:22:48 EST 2011
This gets hard to read as you have to escape with a slash all the double quotes and all the slashes. I could not keep up with those that were 50 lines long, but suspect many other folks can handle it.
This is actually realistic since you have already deployed your addins in some hard coded spot on the network.
The Deploy part is pretty straight forward:
Debug mode would certainly print DxlCode. I've been tempted to write a simple program that accepts a string and escapes the quotes and the slashes. Then I'd get the code to work in an attribute, copy and past into the program, then copy and paste the results into the "string DxlCode" statement above. -Louie "Normal folks" means "Standard Users"! badly formed token ("C:\Program) for this line: string DxlCode = readfile("C:\Program Files\IBM\Rational\DOORS\9.3\lib\dxl\addins\MyDXL\myDXLattribute.dxl") I copied the pathname directly from my explorer window and added the file at the end, so I wouldn't miss a folder or \ ..... is there an issue because it is in the same folder as the dxl menu? I wanted to keep everything together to make life easier. |
Re: Create a DXL Attribute SystemAdmin - Thu Dec 01 17:28:37 EST 2011 |
Re: Create a DXL Attribute kbmurphy - Thu Dec 01 20:09:51 EST 2011 I added the line obj.attrDXLName = Results and declared Results as a string but I recieve errors: null Object parameter was passed into argument position 1 null string parameter was passed into argument position 2 When I take them out again, the code works, but the column isnt displayed in the current view |
Re: Create a DXL Attribute SystemAdmin - Fri Dec 02 11:24:01 EST 2011
The Deployment Part code is run on-demand from the open module, and creates the attribute. You would then use the normal GUI to add ..err.. insert a new column with that attribute to the current view, then save the view.
|
Re: Create a DXL Attribute llandale - Fri Dec 02 12:25:33 EST 2011
The Deployment Part code is run on-demand from the open module, and creates the attribute. You would then use the normal GUI to add ..err.. insert a new column with that attribute to the current view, then save the view.
|
Re: Create a DXL Attribute SystemAdmin - Mon Dec 05 12:30:31 EST 2011 I tried to create a new attribute DXL following your script but an error occurs on the last line. Here is my code : string attName = "AS Identifiant Auto" AttrDef attDef1 = find(m, "AS Identifiant Auto") Buffer DXLsrc = create DXLsrc = "if (!isDeleted(obj)){" DXLsrc += "bool bExigence = obj.\"AS Exigence\"" DXLsrc += "if (bExigence == true) {" DXLsrc += "int iNumero = (obj.\"Absolute Number\")" DXLsrc += "string SPrefixeId = obj.\"AS Prefixe Id\"" DXLsrc += "obj.attrDXLName = SPrefixeId \"\" iNumero \"\"}}}" string DxlCode = stringOf DXLsrc if (null (attDef1)){ AttrDef ad3 = create(object dxl DxlCode type "string" attribute attName) } The error is : <Line:14> Valeur DXL non valide pour l'attribut 'AS Identifiant Auto' du type 'string' What is wrong with that code? |
Re: Create a DXL Attribute Estebell - Thu Sep 27 03:04:27 EDT 2012 You are closing too many curly brackets in the last line of the DXL code, and you lack the new lines, or at least semicolons to distinguish commands. Try
string attName = "AS Identifiant Auto"
Buffer DXLsrc = create
DXLsrc = "if (!isDeleted(obj)){\n"
DXLsrc += " bool bExigence = obj.\"AS Exigence\"\n"
DXLsrc += " if (bExigence == true) {\n"
DXLsrc += " int iNumero = (obj.\"Absolute Number\")\n"
DXLsrc += " string SPrefixeId = obj.\"AS Prefixe Id\"\n"
DXLsrc += " obj.attrDXLName = SPrefixeId \"\" iNumero \"\"\n"
DXLsrc += " }\n"
DXLsrc += "}"
string DxlCode = stringOf DXLsrc
delete DXLsrc
create(object type "string" dxl DxlCode attribute attName)
|
Re: Create a DXL Attribute Peter_Albert - Thu Sep 27 04:34:02 EDT 2012 You are closing too many curly brackets in the last line of the DXL code, and you lack the new lines, or at least semicolons to distinguish commands. Try
string attName = "AS Identifiant Auto"
Buffer DXLsrc = create
DXLsrc = "if (!isDeleted(obj)){\n"
DXLsrc += " bool bExigence = obj.\"AS Exigence\"\n"
DXLsrc += " if (bExigence == true) {\n"
DXLsrc += " int iNumero = (obj.\"Absolute Number\")\n"
DXLsrc += " string SPrefixeId = obj.\"AS Prefixe Id\"\n"
DXLsrc += " obj.attrDXLName = SPrefixeId \"\" iNumero \"\"\n"
DXLsrc += " }\n"
DXLsrc += "}"
string DxlCode = stringOf DXLsrc
delete DXLsrc
create(object type "string" dxl DxlCode attribute attName)
|
Re: Create a DXL Attribute Peter_Albert - Thu Sep 27 04:34:02 EDT 2012 You are closing too many curly brackets in the last line of the DXL code, and you lack the new lines, or at least semicolons to distinguish commands. Try
string attName = "AS Identifiant Auto"
Buffer DXLsrc = create
DXLsrc = "if (!isDeleted(obj)){\n"
DXLsrc += " bool bExigence = obj.\"AS Exigence\"\n"
DXLsrc += " if (bExigence == true) {\n"
DXLsrc += " int iNumero = (obj.\"Absolute Number\")\n"
DXLsrc += " string SPrefixeId = obj.\"AS Prefixe Id\"\n"
DXLsrc += " obj.attrDXLName = SPrefixeId \"\" iNumero \"\"\n"
DXLsrc += " }\n"
DXLsrc += "}"
string DxlCode = stringOf DXLsrc
delete DXLsrc
create(object type "string" dxl DxlCode attribute attName)
By the way, DXL code in a string becomes much more readable if you use multi-line strings in DXL:
Buffer DXLsrc = create
DXLsrc = "
if (!isDeleted(obj)) {
bool bExigence = obj.\"AS Exigence\"
if (bExigence == true) {
int iNumero = (obj.\"Absolute Number\")
string SPrefixeId = obj.\"AS Prefixe Id\"
obj.attrDXLName = SPrefixeId \"\" iNumero \"\"
}
}
"
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|